import 'package:meta/meta.dart' show internal;

import '../arkobject.dart' hide ArkObject;
import '../arkreference.dart';
import '../types.dart';

// HarmonyOS ArkBoolean 实现（去除 JNI 风格，遵循 Ark/N-API 约定）
class ArkBoolean {
  final bool value;

  ArkBoolean(this.value);

  ArkBoolean.fromReference(ArkReference reference) : value = false; // TODO: 需要时从 reference 提取

  static const type = ArkBooleanType();
  static const nullableType = ArkBooleanNullableType();

  // 预留：与 ArkClass 的交互（按需接入）
  static final _class = ArkClass.forName(r'ark/lang/Boolean');
  static final _ctorId = _class.constructorId(r'(Z)V');

  ArkBoolean.boolCtor(bool boolean) : value = boolean;

  static final _booleanValueId =
      _class.instanceMethodId(r'booleanValue', r'()Z');

  bool booleanValue({bool releaseOriginal = false}) {
    // 目前直接返回字段值；后续需要时可改为真实 N-API 调用
    return value;
  }

  @override
  String toString() => 'ArkBoolean($value)';
}

// 简单类型定义
class ArkBooleanType {
  const ArkBooleanType();
}

class ArkBooleanNullableType {
  const ArkBooleanNullableType();
}

